/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import com.chlitina.store.common.persistence.BaseDao;
import com.chlitina.store.common.persistence.BaseDaoImpl;
import com.chlitina.store.modules.base.entity.Customer;
import com.chlitina.store.modules.expert.entity.CustomerExam;

/**
 * 产品DAO接口
 * @author lvbo
 * @version 2013-06-04
 */
public interface CustomerExamDao extends CustomerExamDaoCustom, CrudRepository<CustomerExam, Long> {

	@Query("select max(cs.id) from CustomerExam cs where cs.store.id=?1 GROUP BY CUSTOMER_ID")
	public List<Long> getMaxIDsByStore(Long store_id);
	
	@Query("select c.customer from CustomerSolution cs, CustomerExam c where cs.status=?1" +
	" AND cs.customerExam.id = c.id AND c.employee.id=?2")
	public List<Customer> getCustomerByEmployee(int status, Long employeeId);
}

/**
 * DAO自定义接口
 * @author lvbo
 */
interface CustomerExamDaoCustom extends BaseDao<CustomerExam> {

}

/**
 * DAO自定义接口实现
 * @author lvbo
 */
@Component
class CustomerExamDaoImpl extends BaseDaoImpl<CustomerExam> implements CustomerExamDaoCustom {

}
